UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sD6HpzQt+hh70rErljOr5smaWyg1P77srzkwUeOWPj8='
WHERE
key_id = '314745ee455539c7480fa1decc2df0bf0e0674fd9d517ac7272c9c6b63ae89ff'
AND (
token = 'sD6HpzQt+hh70rErljOr5smaWyg1P77srzkwUeOWPj8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)