UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w9Y+c2fn4+bg4GMouAf1Q5jsqxjL6Dnwy3U0yyiVH6A=' 
WHERE 
  key_id = '7e3d84cfea37ef3620cf496a2878ff66f90a0bddfa13e34402235baea5aa788c' 
  AND (
    token = 'w9Y+c2fn4+bg4GMouAf1Q5jsqxjL6Dnwy3U0yyiVH6A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030