UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5mzWtSHJVPNBI0Qf4B+JaP7H1ykH2IipdMRJQW95rqg=' 
WHERE 
  key_id = '801b2d9d143d8a526dc3ab085410a522eab2e7fa339146c688e2ca2265e88816' 
  AND (
    token = '5mzWtSHJVPNBI0Qf4B+JaP7H1ykH2IipdMRJQW95rqg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00183