UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YtvoF4ikhJACovZN6uMsif3frBklprwXdBHHBrauAvM='
WHERE
key_id = 'dd39b748f3950e3035ec7ee891abb93a50e7b603966ee2463ac98ed778ea6f9c'
AND (
token = 'YtvoF4ikhJACovZN6uMsif3frBklprwXdBHHBrauAvM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)