UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SYHx41P0NtWG3JFfUZbtZMl+DahET3A/tBy2XcdEVyc=' 
WHERE 
  key_id = '99ec2710819a6a72f714827f79b2e669342f2f4d779af8dba30992f564d87147' 
  AND (
    token = 'SYHx41P0NtWG3JFfUZbtZMl+DahET3A/tBy2XcdEVyc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031