UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8rxy1vp0PjtfmXQ2w5pTVcyk4PUqjarv9YTUP9xKMLM='
WHERE
key_id = 'd3995c3dd4cfe82d0a44fe45966efdde2f28d35c10a0f2c61845f272e4c86ed4'
AND (
token = '8rxy1vp0PjtfmXQ2w5pTVcyk4PUqjarv9YTUP9xKMLM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)