UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VV+zNiDppVFCudiEpxcSS5WgvNSxaMNjaE7G9rXkit8='
WHERE
key_id = 'ab9f9cd9c0b2403e0e66d7b7351f333d3f6c5124c348c8ad185ebcf05f7fd800'
AND (
token = 'VV+zNiDppVFCudiEpxcSS5WgvNSxaMNjaE7G9rXkit8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)