UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Fn6gJdDqhlTSqPEHmQj5tb7GRWn7n1O4t3GBy951Avc=' 
WHERE 
  key_id = '4316ca867a9160bc6d0eaa824e35d20426866c4cc16ece428a632534f845504b' 
  AND (
    token = 'Fn6gJdDqhlTSqPEHmQj5tb7GRWn7n1O4t3GBy951Avc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030