UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DOYE2Oj5rxyze3Yxg9VbFMbMpbYoKtbyVnqnEHqT11g=' 
WHERE 
  key_id = '1b9e00f490e2b4844ca0533ff7ea8514982b96138bec3d58e15233dd1dc72610' 
  AND (
    token = 'DOYE2Oj5rxyze3Yxg9VbFMbMpbYoKtbyVnqnEHqT11g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035