UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BGnqDgZ3WOcJifGzNrb300KxrAQfT6FdRVkl+IyU2ac='
WHERE
key_id = 'a3413ed840e60d4d1d1d719ab3954c547e0ceed9308d087ce404cd610137c8cb'
AND (
token = 'BGnqDgZ3WOcJifGzNrb300KxrAQfT6FdRVkl+IyU2ac='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)