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