UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g7tZkalMp35PDrFIyYk9+UCcRL6YfZ094+LryXK+ubo='
WHERE
key_id = 'b95ef0b82148b0ae1601271f248ae1eca59ea72832e1c9f1b55454725473795d'
AND (
token = 'g7tZkalMp35PDrFIyYk9+UCcRL6YfZ094+LryXK+ubo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)