UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'H+3CpP3pbmWndiKt0cuiyClojNiNuAgZRUSDk1Cfa7Q='
WHERE
key_id = '9d585faf41b7fa44e656ff5c22aa631eb6d57041af894b8a3eed676d120ee86e'
AND (
token = 'H+3CpP3pbmWndiKt0cuiyClojNiNuAgZRUSDk1Cfa7Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)