UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gwvKlZXdqKo4+nwHSVPrNqUf7MsHlafEDO3IwLfFWV0='
WHERE
key_id = 'fcf476a35e7e7227cd49dd63cd2c86d0471989a4c8b166b8b82635c350636ce3'
AND (
token = 'gwvKlZXdqKo4+nwHSVPrNqUf7MsHlafEDO3IwLfFWV0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)