UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nk8W1HdqLTXi8qQIepQ5rl2w0zQndO99wSPigWKpj1U=' 
WHERE 
  key_id = 'c738e496fc445df6cbdf60ebb5587135aed6448818388afc72f6d2d50d564b01' 
  AND (
    token = 'Nk8W1HdqLTXi8qQIepQ5rl2w0zQndO99wSPigWKpj1U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026