UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M/Nmf/nG7ftyZMM2pKeKgJpI3xgTgYZ0PZTDOvJfRLQ=' 
WHERE 
  key_id = 'e139ae33786f25a487038f399298eab7f71cb50a935e042200853248a3af8400' 
  AND (
    token = 'M/Nmf/nG7ftyZMM2pKeKgJpI3xgTgYZ0PZTDOvJfRLQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038