UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GIpOIFxxmE1FE4MzUDJ8WFnfs7DdPL/5+6bWrYtOB18='
WHERE
key_id = 'c1e2184367652e8a3dc3269e3d1d93dbd9d4e148925d3002b42143544ebbf40d'
AND (
token = 'GIpOIFxxmE1FE4MzUDJ8WFnfs7DdPL/5+6bWrYtOB18='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)