UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X86nWQfcdhfq3ZpIaD8KylSJApIcsQqdKWEspN79aXc=' 
WHERE 
  key_id = '8b82f8707d412eca785f574749242210ed968e0fccaf13c250ba20e269dca271' 
  AND (
    token = 'X86nWQfcdhfq3ZpIaD8KylSJApIcsQqdKWEspN79aXc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038