UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'efa7uggZXdcT0t8H+CIFsuEY4yEe3zddt6I9Ows9UK0='
WHERE
key_id = '8cf7481742375c60903aa9b8911a81445a6652896157cfe694144fb9abdbfdf5'
AND (
token = 'efa7uggZXdcT0t8H+CIFsuEY4yEe3zddt6I9Ows9UK0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)