UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vlwxbaX0DMQ8IJsxU+VvFKbJAGi612cq17nWskLhxGI=' 
WHERE 
  key_id = 'c52338d849c2a37983bd54ab467497e74f3516975083da260981804b73fe83d6' 
  AND (
    token = 'vlwxbaX0DMQ8IJsxU+VvFKbJAGi612cq17nWskLhxGI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032