UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oU8bHXmgTGfmW2FwPhCHG2gmE8+msaG475PfE237GsI='
WHERE
key_id = '1421448cdefc4bbdef0f1bf79e74d70bd5a325c9286be40b2de04c24c08789a2'
AND (
token = 'oU8bHXmgTGfmW2FwPhCHG2gmE8+msaG475PfE237GsI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)