UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zS0Jwhx7iRLqWTuOmHBbgfUrNE8bI1AgD/SIN/gIZGw='
WHERE
key_id = 'c8979433465928a108948b66e5b5c1b6047a777a9c575430746c191b112567cb'
AND (
token = 'zS0Jwhx7iRLqWTuOmHBbgfUrNE8bI1AgD/SIN/gIZGw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)