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

Query time 0.00032