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

Query time 0.00025