UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T3bdOHc4FRZ3KI6rK847rPh3MSna+rF9KqeqMwUu1Ao=' 
WHERE 
  key_id = '2586a5a085f58fce9ce9eb57dddcf7478de5ede5c96c57c28656c1ce88aa1c1b' 
  AND (
    token = 'T3bdOHc4FRZ3KI6rK847rPh3MSna+rF9KqeqMwUu1Ao=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00079