UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lBgrI/fhtzF9BEejPxgbOAygz1zoy5p0PvWXL+pDLes='
WHERE
key_id = '3bdf49ebde36779123d660e6f5ce4118d45630fd24c656c57476fae9a0afced1'
AND (
token = 'lBgrI/fhtzF9BEejPxgbOAygz1zoy5p0PvWXL+pDLes='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)