UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KtNcAZzvms7VEP+naddlw0Q6yUFmjLtnh9YeFpwfr80=' 
WHERE 
  key_id = '3955948fb55bc312109a3db980cb6aeda50ce42044e9d83712cb585c0d2f738d' 
  AND (
    token = 'KtNcAZzvms7VEP+naddlw0Q6yUFmjLtnh9YeFpwfr80=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045