UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0JqwMBKxG3acrEszD8N1U6nSZ9PblTFc+x+8BD+YPMA=' 
WHERE 
  key_id = '5bddcf00a51aa9d954b51882f87852a43fd72f3fc60d12469b5d19018c82873f' 
  AND (
    token = '0JqwMBKxG3acrEszD8N1U6nSZ9PblTFc+x+8BD+YPMA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019