UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HpkWS8cgoQU/LKXmmWtinGYhVVG887313w0AMGWU9XU='
WHERE
key_id = '09d8c914b7ebce7aa89c0c7d3e1a7b08fa51763c2f82955b09ce1a1996a63fd3'
AND (
token = 'HpkWS8cgoQU/LKXmmWtinGYhVVG887313w0AMGWU9XU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)