UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ogA6prvgYYdr7zMv4+a59wN6jj8jnEL9h9C6oE26qTk='
WHERE
key_id = 'db0128a5f4b1e7a3d85c0bf0bd1540d6cf1c4814a0c2eb976f4139d525e178f0'
AND (
token = 'ogA6prvgYYdr7zMv4+a59wN6jj8jnEL9h9C6oE26qTk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)