UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bray53RihUKstkPUKBYO4NBsokymIZPwouc0lHFAVmw=' 
WHERE 
  key_id = '7eea5a7d028df4c552f33ebcf61de71b074e2b17b2586380f787825784392c51' 
  AND (
    token = 'Bray53RihUKstkPUKBYO4NBsokymIZPwouc0lHFAVmw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031