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