UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'te4tZ2OIDTtDbwA+1wmudd7d+Q68knURXJhCbLa69t4='
WHERE
key_id = '59dcf5bb55e99e1c93b7e8d976b612438b0301663a912a95c6f9da061fbb9ae5'
AND (
token = 'te4tZ2OIDTtDbwA+1wmudd7d+Q68knURXJhCbLa69t4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)