UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NDdiqY07juH5ABsbkjMTsNrm17c4iGmED6DguoU6nug='
WHERE
key_id = 'd3c0a12e06420c7e21c12412f0f930de8a2bd1621ee3bd319d95c38ce528e375'
AND (
token = 'NDdiqY07juH5ABsbkjMTsNrm17c4iGmED6DguoU6nug='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)