UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aT5oZZ77AlfbDVZz6oAGTyIdSC1KxVz18FRNWSXFJjg='
WHERE
key_id = '395121ee7197d3fb448f42381c58c7b5d23a8c048e00863789fe454c7e57bb0e'
AND (
token = 'aT5oZZ77AlfbDVZz6oAGTyIdSC1KxVz18FRNWSXFJjg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)