UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YYptevxsYg+2RkbshL/zfHbNfXjZnaReWfV/1lZiquQ='
WHERE
key_id = '59f3bf9f634c022a620242b63772ecc2a1467864c3a9f8daa4906b5a3d83f6df'
AND (
token = 'YYptevxsYg+2RkbshL/zfHbNfXjZnaReWfV/1lZiquQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)