UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6Dxutuo5n5fWCMINANYP7lG6up+RpXvMT0VILWqj0q8='
WHERE
key_id = '12cda31ab4ec75bafb496ab37e08726b7fa9a1b93c0befab4d08f8e004d59cc9'
AND (
token = '6Dxutuo5n5fWCMINANYP7lG6up+RpXvMT0VILWqj0q8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)