UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NUeZYgRvjTAOqVuNNN5BMuHSQYruC0743X+gquWECtw=' 
WHERE 
  key_id = '8701d96813be89532473f44bd49a4eb2b0d3df9a3693ecf2bbc37ec79b28c73b' 
  AND (
    token = 'NUeZYgRvjTAOqVuNNN5BMuHSQYruC0743X+gquWECtw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018