UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9HX31eX0BmZBhNnm2VBAtEVLKvWj/jXkkml7zZT0h4U='
WHERE
key_id = '492f28f581642b2f9f48fda6c4543e962c5f20f1524d45e43024d08a39221366'
AND (
token = '9HX31eX0BmZBhNnm2VBAtEVLKvWj/jXkkml7zZT0h4U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)