UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ovEY3Qot41xo+ibwlvWFhwJmjLMbimDqU6iT2vk76Pc=' 
WHERE 
  key_id = '4130364fd618ecb06f113f35f64f36aca43a7ce769845ba146d9b84e07fd391e' 
  AND (
    token = 'ovEY3Qot41xo+ibwlvWFhwJmjLMbimDqU6iT2vk76Pc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030