UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aqEt5JHsdbpGc7xg/po1FfePa2eEy3kxbCDDYrA8jc8='
WHERE
key_id = 'f638dcde5807443077eb85cb192bca0c6e6fdfd0cedc0338c27785a4f2ef3bdd'
AND (
token = 'aqEt5JHsdbpGc7xg/po1FfePa2eEy3kxbCDDYrA8jc8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)