UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sXxNbmu+cT+KKWreO+18ZMLxMaqBnE2VsxuYVRI+mlg='
WHERE
key_id = '1f58e326c4ac84aadb69e1a1e2ef86c3bfcddf7eac1aca4d21e517df4039fa87'
AND (
token = 'sXxNbmu+cT+KKWreO+18ZMLxMaqBnE2VsxuYVRI+mlg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)