UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'U8rBYEj5WtznRxNgARFqWtp1WRhEtHEfOIj4HPczl5I='
WHERE
key_id = '574627629a6ef5d383b149452344f96d13173808e2db3729e744542837abd966'
AND (
token = 'U8rBYEj5WtznRxNgARFqWtp1WRhEtHEfOIj4HPczl5I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)