UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U19Be8IfkEb5yengQtKDm1vyA1U976V0CjGvkS6oF4E=' 
WHERE 
  key_id = 'c65d5d9efdba86df4372aca0c6c8305a340b56334a1424f0cf36092b87f00a9f' 
  AND (
    token = 'U19Be8IfkEb5yengQtKDm1vyA1U976V0CjGvkS6oF4E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038