UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qDUpGIs4ak2ZjHMqIRO7yONJjgaCETma6kiQiguqTHA='
WHERE
key_id = '127a8c3910d9de1c3c5f9bbfd8db5d5e7a479985d1ddc789478535be7c2b6237'
AND (
token = 'qDUpGIs4ak2ZjHMqIRO7yONJjgaCETma6kiQiguqTHA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)